<template>
  <transition name="el-fade-in">
    <div class="root-container" v-if="Props.fullScreen && showAlert && !closed">
      <div
        :class="[
          'front-container',
          darkMode ? 'container-dark' : 'container-light',
          closing ? 'zoom-close' : '',
          // opening ? 'zoom-open' : '',
        ]"
      >
        <!-- <div class="command-container">
    </div> -->
        <el-result>
          <template #icon>
            <el-icon
              class="round"
              style="color: var(--el-color-error); width: 200px; height: 200px"
            >
              <CircleCloseFilled style="width: 100%; height: 100%" />
            </el-icon>
          </template>
          <template #title>
            <h1 class="title">
              <!-- <span
              class="vibrate vibrate-0"
              style="width: 50px; height: 50px; margin-right: 6px"
            >
              <Logo />
            </span> -->
              <!-- <span class="vibrate vibrate-1">已</span>
              <span class="vibrate vibrate-2">暂</span>
              <span class="vibrate vibrate-3">停</span>
              <span class="vibrate vibrate-4">使</span>
              <span class="vibrate vibrate-5">用</span> -->
              <span>已停止自动更新</span>
            </h1>
          </template>
          <template #sub-title>
            <p style="font-size: 16px; padding-top: 12px">
              <span>根据相关要求，该功能已停止自动采集</span>
              <b>{{ Props.alertName }}</b>
              <span>数据</span>
            </p>
          </template>
          <template #extra>
            <!-- <el-link type="danger" @click="handleClose">
              <span>关闭提示</span>
            </el-link> -->
            <el-button type="danger" size="small" @click="handleClose">
              <span>关闭提示</span>
            </el-button>
          </template>
        </el-result>
      </div>
    </div>
    <div class="wrapper-root" v-else>
      <div class="wrapper-icon">
        <el-icon :size="64">
          <CircleCloseFilled />
        </el-icon>
      </div>
      <div class="wrapper-text">
        <div class="wrapper-text-title">
          <span>已停止自动更新</span>
          <!-- <el-button type="danger" link @click="handleClose">
            <span>关闭</span>
          </el-button> -->
        </div>
        <div class="wrapper-text-message">
          根据相关要求，该功能已停止自动采集 {{ Props.alertName }} 数据！
        </div>
      </div>
    </div>
  </transition>
</template>

<script setup>
import { ref, computed, onMounted } from "vue";
import Logo from "@/components/brand/logo.vue";
import useCommonStore from "@/store/common.js";
import useSeatStore from "@/store/seat.js";

const Props = defineProps({
  fullScreen: {
    type: Boolean,
    required: false,
    default: true,
  },
  alertName: {
    type: String,
    required: false,
    default: "ATCOS",
  },
});

const commonStore = useCommonStore();
const seatStore = useSeatStore();

const darkMode = computed(() => commonStore.darkMode);

const isServiceAvailable = computed(() => seatStore.isServiceAvailable);
const isSeatAvailable = computed(() => seatStore.isSeatAvailable);
const showAlert = computed(
  () => seatStore.isSeatAvailable && !seatStore.isServiceAvailable
);

const closed = ref(false);
const closing = ref(false);
const opening = ref(true);

const handleClose = () => {
  closing.value = true;
  setTimeout(() => {
    closed.value = true;
    closing.value = false;
  }, 500);
};

onMounted(() => {
  // setTimeout(() => {
  //   opening.value = false;
  // }, 1000);
});
</script>

<style scoped>
@import "@/styles/vibrate.css";
@import "@/styles/round.css";
@import "@/styles/blinking.css";
@import "@/styles/zoom.css";

.root-container {
  color: var(--el-text-color-primary);
}

.container-dark {
  /* border: 1px solid rgba(0, 0, 0, 0.5); */
  background-color: rgba(0, 0, 0, 0.6);
}

.container-light {
  /* border: 1px solid rgba(255, 255, 255, 0.5); */
  background-color: rgba(255, 255, 255, 0.6);
}
.front-container {
  position: absolute;
  /* top: max(50px, 10%);
  left: max(100px, 15%);
  bottom: max(50px, 10%);
  right: max(100px, 15%); */
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  z-index: 10;
  /* border-radius: 12px; */
  backdrop-filter: blur(10px);
  padding: 18px;
  overflow: hidden;
  box-shadow: 2px 0px 12px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
}
.back-container {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  right: 45%;
  z-index: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0.75;
  /* filter: blur(1px); */
}

.image-container {
  width: 100%;
  padding: min(100px, 10%);
}

.json-container {
  padding-left: 24px;
  font-size: 20px;
  line-height: 40px;
  filter: blur(3px);
  color: var(--el-text-color-primary);
  text-shadow: 0 0 20px var(--el-text-color-primary);
  opacity: 0.4;
}

.title {
  display: inline-flex;
  height: 24px;
}
.title > * {
  padding: 0 1px;
}
.inner-container {
  width: 100%;
  height: 100%;
  display: flex;
  /* align-items: center; */
  padding-top: 60px;
}

.content-container {
  width: 100%;
  height: 100%;
  display: flex;
}

.command-container {
  position: absolute;
  right: 12px;
  top: 12px;
}

.text-small {
  font-size: 12px;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.text-small > * {
  margin-right: 4px;
}

.wrapper-root {
  position: absolute;
  left: 0px;
  bottom: 8px;
  width: 300px;
  height: 80px;
  display: flex;
  align-items: center;
  padding: 8px;
  z-index: 999;
  border: 2px solid transparent;
  border-radius: 16px;
  background-clip: padding-box, border-box;
  background-origin: padding-box, border-box;
  background-image: linear-gradient(to right, #222, #222),
    linear-gradient(90deg, #8f41e9, #578aef);
  transform: scale(0.92);
  transition: all 0.5s ease;
  opacity: 0.5;
  cursor: pointer;
}

.wrapper-root:hover {
  /* transform: scale(0.93); */
  opacity: 1;
}

.wrapper-icon {
  /* width: 100px; */
  color: var(--el-color-error);
}

.wrapper-text {
  /* width: 250px; */
  padding-left: 8px;
}

.wrapper-text-title {
  font-size: 18px;
  font-weight: bolder;
  color: var(--el-text-color-regular);
  padding-bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.wrapper-text-message {
  font-size: 12px;
  color: var(--el-text-color-regular);
  text-align: justify;
}
</style>
